package com.sykj.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sykj.bean.bis.BisNurseBag;
import com.sykj.bean.card.BisNurseBagDto;
import com.sykj.bean.card.CardGame;
import com.sykj.mapper.GameLoadMapper;
import com.sykj.service.BisNurseBagService;
import com.sykj.util.reponse.CommonEnum;
import com.sykj.util.reponse.ResultBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: BeautyClub
 * @description:
 * @author: qiaoli
 * @create: 2020-08-10 16:47
 */
@RestController
@RequestMapping("/bisnursebag")
public class BisNurseBagContoller {
    @Autowired
    BisNurseBagService bisNurseBagService;

    @Autowired
    GameLoadMapper gameLoadMapper;
    @GetMapping("/querylist/{curpage}/{limit}")
    public ResultBody queryList(@PathVariable int curpage, @PathVariable int limit){
        if (curpage > 0 && limit > 0){
            PageHelper.startPage(curpage,limit);
        }
        List<BisNurseBag> list = bisNurseBagService.list();
        PageInfo<BisNurseBag> pageInfo=new PageInfo(list);
        return new ResultBody(CommonEnum.SUCCESS,pageInfo);
    }

        @RequestMapping("/queryByid/{customUserId}")
        public ResultBody   queryByid(@PathVariable("customUserId") String customUserId){
            List<BisNurseBagDto> bisNurseBagDtos = gameLoadMapper.queryBagByuserid(customUserId);
            return new ResultBody(CommonEnum.SUCCESS, bisNurseBagDtos);

    }
}
